package com.timk.goserver.server.util;

import java.io.IOException;
import java.util.Properties;

/**
 * Wrapper for global properties file
 * @author TKington
 *
 */
public class GlobalProperties {
	private static Properties globalProps;
	static {
		//ClassLoader loader = ClassLoader.getSystemClassLoader();
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    if( loader == null )
    {
      loader = ClassLoader.getSystemClassLoader();
    }
		
		globalProps = new Properties();
		try {
			globalProps.load(loader.getResourceAsStream("goserver.properties"));
			
		} catch(IOException e) {
			GSLogger.logError("Couldn't load goserver.properties", e);
		}
	}
	
	/**
	 * Returns the value of a property
	 * @param key the key
	 * @return the value of the property
	 */
	public static String getProperty(String key) {
		return globalProps.getProperty(key);
	}
}
